.. _ocaswitch: 1.1.1.4 OcaSwitch ================== Class Hierarchy: :ref:`OcaRoot ` :raw:html:`→` :ref:`OcaWorker ` :raw:html:`→` :ref:`OcaActuator ` :raw:html:`→` :ref:`OcaSwitch ` .. cpp:class:: OcaSwitch: OcaActuator (n)-position single-pole switch. **Properties**: .. _ocaswitch_classid: .. cpp:member:: static const OcaClassID ClassID = "1.1.1.4" Number that uniquely identifies the class. Note that this differs from the object number, which identifies the instantiated object. This property is an override of the **OcaRoot** property. This property has id ``4.1``. .. _ocaswitch_classversion: .. cpp:member:: static const OcaClassVersionNumber ClassVersion = 2 Identifies the interface version of the class. Any change to the class definition leads to a higher class version. This property is an override of the **OcaRoot** property. This property has id ``4.2``. .. _ocaswitch_position: .. cpp:member:: OcaUint16 Position The current position of the switch. Positions shall be numbered from minPosition to (including) maxPosition. If the object does not return the optional parameters minPosition and maxPosition in its GetPosition method the positions shall be numbered from 1 to n. This property has id ``4.1``. .. _ocaswitch_positionnames: .. cpp:member:: OcaList PositionNames Vector of switch position names. Supplied by controller. This property has id ``4.2``. .. _ocaswitch_positionenableds: .. cpp:member:: OcaList PositionEnableds Vector of booleans which enable or disable corresponding switch positions. Default values are a construction parameter. The usual default value is True. This property has id ``4.3``. Properties inherited from :ref:`OcaWorker `: - :cpp:texpr:`OcaBoolean` :ref:`OcaWorker::Enabled ` - :cpp:texpr:`OcaList` :ref:`OcaWorker::Ports ` - :cpp:texpr:`OcaString` :ref:`OcaWorker::Label ` - :cpp:texpr:`OcaONo` :ref:`OcaWorker::Owner ` - :cpp:texpr:`OcaTimeInterval` :ref:`OcaWorker::Latency ` Properties inherited from :ref:`OcaRoot `: - :cpp:texpr:`OcaONo` :ref:`OcaRoot::ObjectNumber ` - :cpp:texpr:`OcaBoolean` :ref:`OcaRoot::Lockable ` - :cpp:texpr:`OcaString` :ref:`OcaRoot::Role ` **Methods**: .. _ocaswitch_getposition: .. cpp:function:: OcaStatus GetPosition(OcaUint16 &position, OcaUint16 &minPosition, OcaUint16 &maxPosition) Gets the value of the Position property and, optionally, its implementation min and max. The return value indicates whether the data was successfully retrieved. This method has id ``4.1``. :param OcaUint16 position: Output parameter. :param OcaUint16 minPosition: Output parameter. :param OcaUint16 maxPosition: Output parameter. .. _ocaswitch_setposition: .. cpp:function:: OcaStatus SetPosition(OcaUint16 position) Sets the value of the Position property. The return value indicates whether the property was successfully set. This method has id ``4.2``. :param OcaUint16 position: Input parameter. .. _ocaswitch_getpositionname: .. cpp:function:: OcaStatus GetPositionName(OcaUint16 Index, OcaString &Name) Gets the name assigned to a given switch position. The return value indicates whether the name was successfully retrieved. This method has id ``4.3``. :param OcaUint16 Index: Input parameter. :param OcaString Name: Output parameter. .. _ocaswitch_setpositionname: .. cpp:function:: OcaStatus SetPositionName(OcaUint16 Index, OcaString Name) Assigns a name to a given switch position. The return value indicates whether the name was successfully assigned. This method has id ``4.4``. :param OcaUint16 Index: Input parameter. :param OcaString Name: Input parameter. .. _ocaswitch_getpositionnames: .. cpp:function:: OcaStatus GetPositionNames(OcaList &Names) Gets list of names assigned to the switch's positions. The return value indicates whether the names were successfully retrieved. This method has id ``4.5``. :param OcaList Names: Output parameter. .. _ocaswitch_setpositionnames: .. cpp:function:: OcaStatus SetPositionNames(OcaList Names) Assigns names to the switch's positions. The return value indicates whether the names were successfully assigned. This method has id ``4.6``. :param OcaList Names: Input parameter. .. _ocaswitch_getpositionenabled: .. cpp:function:: OcaStatus GetPositionEnabled(OcaUint16 Index, OcaBoolean &enabled) Gets the Enabled flag assigned to a given switch position. The return value indicates whether the flag was successfully retrieved. This method has id ``4.7``. :param OcaUint16 Index: Input parameter. :param OcaBoolean enabled: Output parameter. .. _ocaswitch_setpositionenabled: .. cpp:function:: OcaStatus SetPositionEnabled(OcaUint16 Index, OcaBoolean enabled) Sets the Enabled flag assigned to a given switch position. The return value indicates whether the flag was successfully set. This method has id ``4.8``. :param OcaUint16 Index: Input parameter. :param OcaBoolean enabled: Input parameter. .. _ocaswitch_getpositionenableds: .. cpp:function:: OcaStatus GetPositionEnableds(OcaList &enableds) Gets list of Enabled flags assigned to the switch's positions. The return value indicates whether the flags were successfully retrieved. This method has id ``4.9``. :param OcaList enableds: Output parameter. .. _ocaswitch_setpositionenableds: .. cpp:function:: OcaStatus SetPositionEnableds(OcaList enableds) Sets list of Enabled flags for the switch's positions. The return value indicates whether the flags were successfully set. This method has id ``4.10``. :param OcaList enableds: Input parameter. Methods inherited from :ref:`OcaWorker `: - :ref:`OcaWorker::GetEnabled(enabled) ` - :ref:`OcaWorker::SetEnabled(enabled) ` - :ref:`OcaWorker::AddPort(Label, Mode, ID) ` - :ref:`OcaWorker::DeletePort(ID) ` - :ref:`OcaWorker::GetPorts(OcaPorts) ` - :ref:`OcaWorker::GetPortName(PortID, Name) ` - :ref:`OcaWorker::SetPortName(PortID, Name) ` - :ref:`OcaWorker::GetLabel(label) ` - :ref:`OcaWorker::SetLabel(label) ` - :ref:`OcaWorker::GetOwner(owner) ` - :ref:`OcaWorker::GetLatency(latency) ` - :ref:`OcaWorker::SetLatency(latency) ` - :ref:`OcaWorker::GetPath(NamePath, ONoPath) ` Methods inherited from :ref:`OcaRoot `: - :ref:`OcaRoot::GetClassIdentification(ClassIdentification) ` - :ref:`OcaRoot::GetLockable(lockable) ` - :ref:`OcaRoot::LockTotal() ` - :ref:`OcaRoot::Unlock() ` - :ref:`OcaRoot::GetRole(Role) ` - :ref:`OcaRoot::LockReadonly() `